﻿
@{
    ViewBag.Title = "More";
    Layout = "~/Views/Shared/_LayoutFront.cshtml";
}
<style>
    .article-content article p {
        display: none;
    }

        .article-content article p:nth-child(1) {
            display: block;
        }

         .header-nav {
        background-color: #b9abce;
    }

    body {
        color: black;
    }
</style>
<div>
    <header class="article_list_more_header">
        <div> <a href="/news/Index">首页</a>&#62;<a href="/news/Index">鲜花资讯</a>&#62;<a href="/news/Index">更多</a></div>
    </header>

    <section class="article-content">
        @*<ul>
                <li>
                    <div class="article-date">
                        <strong>01</strong>
                        <p>2017/05</p>
                    </div>
                    <div class="article-info">
                        <a href="article_list_content.html">
                            <h3>家具有哪些类型?</h3>
                            <p>按家具从风格上可以分为：现代家具、欧式古典家具、美式家具、中式古典家具（也就是红木家具），还有近两年比较流行的新古典...</p>
                        </a>
                    </div>
                </li>


            </ul>*@
        <ul>
            <div id="div_list">
                @*@foreach (var item in ViewBag.A)
                    {

                            <li>
                                <div class="article-date">
                                    <strong>@item.Day</strong>
                                    <p>@item.NianYue</p>
                                </div>
                                <div class="article-info">
                                    <a href="/NewsDetail/Index/@item.Id">
                                        <h3>@item.Title</h3>
                                        <p class="ty">@item.Cont</p>
                                    </a>
                                </div>
                            </li>

                        }*@
            </div>
            <div style="padding-left:350px;" id="my_page"></div>
        </ul>

    </section>

</div>
<script>
    $(function () {
        var pageNum = 1;
        var limit = 2;
        getData(pageNum, limit);
        function getData(pageNum, limit) {
            $.ajax({
                url: "/NewsDetail/DelPage",
                type: "post",
                dataType: "json",
                data: {
                    page: pageNum,
                    limit: limit
                },
                success: function (res) {
                    if (res.success == true) {
                        console.log(res);
                        var str = "";
                        for (var i = 0; i < res.data.length; i++) {
                            str = str + '<li><div class="article-date"><strong>'
                            +res.data[i].Day +'</strong><p>'
                            + res.data[i].NianYue +
                            '</p></div><div class="article-info"><a href="/NewsDetail/Index/'
                            + res.data[i].Id +
                            '"><h3>'
                            + res.data[i].Title +
                            '</h3><article>'
                            + res.data[i].Cont + '</article></a></div></li>'
                        }
                        $("#div_list").html(str);

                        //分页
                        $("#my_page").sPage({
                            page: pageNum,
                            total: res.count,
                            pageSize: limit,
                            fastForward: 0,
                            backFun: function (p) {
                                pageNum = p;
                                getData(pageNum, limit);
                            }
                        })
                    }
                }
            })
        }





    });
</script>